Solve for each connected component.
Given a graph that is not necessarily connected, it is often the case that when it is divided into connected components, the different connected components do not affect each other
In such a case, first divide the graph into linkage components and then solve them individually, which is easier with the restriction that they are connected graphs. If it is a consolidation, for example
There are trees throughout the area.
V-1 or more sides
If the side is V-1, it is a tree
---
This page is auto-translated from /nishio/連結成分ごとに解けば良い. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.